package com.alcatel_lucent.scalastudy


import com.alcatel_lucent.scalastudy.model.Rational
import org.springframework.context.annotation.{ImportResource, Configuration, Bean}
import org.springframework.jdbc.datasource.DriverManagerDataSource
import org.springframework.beans.factory.annotation.Value

/**
 * Created with IntelliJ IDEA.
 * User: Guoshun Wu
 * Date: 13-6-14
 * Time: 下午8:36
 */

@Configuration
@ImportResource(Array("classpath:/spring.xml"))
class AppConfig {

  @Value("${jdbc.url}")
  private val url = ""

  @Value("${jdbc.username}")
  private val username = ""

  @Value("${jdbc.password}")
  private val password = ""

  @Bean
  def rationalBean() = {
    new Rational(3, 5)
  }

  @Bean
  def dataSource() = {
    new DriverManagerDataSource(url, username, password)
  }
}
